function Fig2_f()
data = 48;
Fcolor='k';
Bcolor='w';
Fsize=18;  %font size

result = CS1_0_extraction_2D_Phi(data);

%%%% crop out area affected by other defect
phi = (result.phi(1:101,20:120)-result.avg)*1000;
[nr_sub,nc_sub] = size(phi);

%%%% fft and covert unit from Fseries to Ftransform %%%%
center_x = (nr_sub+1)/2; center_y = (nc_sub+1)/2;
[X,Y] = meshgrid([0:nr_sub-1]*2*pi/nr_sub , [0:nc_sub-1]*2*pi/nc_sub);
phshift = exp(1j*X*center_x) .* exp(1j*Y*center_y);

phi_fft = fftshift( fft2(phi).* phshift) * (result.lx / (result.nx-1) / result.lb)^2;

%%%% plot fft space %%%%
f=figure('name',['Grid:',num2str(data)]);
fx=linspace(-1,1,nc_sub).* (pi*10.47 / (result.lx/(result.nc-1)) );
fy=linspace(-1,1,nr_sub).* (pi*10.47 / (result.ly/(result.nr-1)) );

imagesc(fx,fy,real(phi_fft));

ax = gca;
ax.YDir='normal';ax.XDir='normal';
axis equal;axis square;
f.Color = Bcolor;ax.Color=Bcolor;
ax.XColor=Fcolor;ax.YColor=Fcolor;
xl=xlabel('kx/kf');yl=ylabel('ky/kf');
yl.FontSize=Fsize;xl.FontSize=Fsize;
ax.FontSize=Fsize;
cMap=getColor('BlueGreenOrange');
colormap(cMap);
% ax.CLim=[30,550];
ax.CLim=[-10,10];
axis([-4 4 -4 4]);

%%%%%%%%%%%%%%%%%%%%
scale = 4;
phi_fft = imresize(real(phi_fft),scale);


[nr,nc] = size(phi_fft);
tmpy = meshgrid(1:nr)'-(nr+1)/2;
tmpx = meshgrid(1:nc)-(nc+1)/2;
[~,polXY] = cart2pol(tmpy,tmpx);
%flattern the matrix
polXY2= reshape(polXY,[],1);
phi22 = reshape(phi_fft,[],1);
%sort
[polXY2_sorted,I] = sort(polXY2);
phi22_sorted = phi22(I);

%group data by pixel
n_grouped=30*scale;
phi_grouped_count = zeros(n_grouped,1);
k=1;
phi_group2=cell(1,n_grouped);
for i=1:nr*nc
    if polXY2_sorted(i)>k
        k = k+1;
    end
    if k>n_grouped
        break;
    end
    
    phi_grouped_count(k) = phi_grouped_count(k)+1;
    phi_group2{k} = [phi_group2{k} , phi22_sorted(i)];
end
%calculate azimuthal distance by pixel
az_r = (1:n_grouped)*(fx(2)-fx(1))/scale;



for i=1:n_grouped
    az_phi(i) = mean(phi_group2{i});
    az_phi_err(i) = std(phi_group2{i});
end

g=figure('name',['Grid:',num2str(data)]);

plot(az_r,az_phi,'LineWidth',1);

g.Color = Bcolor;
ax = gca;
ax.Color=Bcolor;
ax.XColor=Fcolor;
ax.YColor=Fcolor;
xl=xlabel('k lB');
yl=ylabel('');
ax.FontSize=Fsize;
yl.FontSize=Fsize;
xl.FontSize=Fsize;

axis([0 4 -20 8]);

end